<template>
  <div ref="chart" style="width: 600px; height: 400px;" />
</template>

<script>
import * as echarts from 'echarts'

export default {
  mounted() {
    this.chart = echarts.init(this.$refs.chart)
    this.createCharts()
  },
  methods: {
    createCharts() {
      const option = {
        xAxis: {
          type: 'value'
        },
        yAxis: {
          type: 'category',
          data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'],
          axisLine: {
            show: false
          },
          axisTick: {
            show: false
          },
          axisLabel: {
            fontSize: 14
          }
        },
        series: [
          {
            data: [120, 200, 150, 80, 70, 110, 130],
            type: 'bar',
            barWidth: 10, // 调整柱状图的宽度
            itemStyle: {
              normal: {
                color: 'orangered' // 柱状图颜色

              }
            }
          }
        ]
      }
      this.chart.setOption(option)
    }
  }
}
</script>
